import React from "react";
import A from "./A";
//1. 创建 Context 对象
export let StrContext = React.createContext();

export default function Context() {
    // let str = '我的手机坏了, 怎么收不到你的信息~~~';
    //声明状态
    let [count, setCount] = React.useState(100);

    return (
        <div>
            {/* 2. 设置 Context.Provider 组件包裹子元素  value 设置初始值 */}
            <StrContext.Provider value={{count, setCount}}>
                <A />
            </StrContext.Provider>
        </div>
    );
}
